사용자 도구

사이트 도구


javascript:bootstrap

Javascript Bootstrap

ES6 import/export import './a.css' babel (es6 → es5) webpack (loader, plugin)

>npm init
>npm install webpack --save-dev
>npm install @babel/preset-env --save-dev
>npm install webpack-dev-server --save-dev
webpack.config.js
var path = require('path');
 
module.exports = {
  mode: 'development', // 'production', 'development', 'none'
  entry: './src/index.js',
  output: {
    filename: 'bundle.js',
    path: path.resolve(__dirname, 'dist'),
    publicPath: '/dist'
  },
  module: {
    rules : [{
      test: /\.js$/,
      include: path.resolve(__dirname, 'src'),
      use: {
        loader: 'babel-loader',
        options: {
          presets : [
            ['@babel/env', {
              'targets': {
                // "android": "67",
                // "chrome": "73",
                // "edge": "17",
                // "firefox": "65",
                // "ie": "10",
                // "ios": "12",
                // "opera": "12.1",
                // "safari": "12",
                // "samsung": "8.2",
                'browsers': ['last 2 versions']
              },
              debug: true
            }]
          ]
        }
      }
    }]
  }
}
javascript/bootstrap.txt · 마지막으로 수정됨: 2025/04/15 10:05 저자 127.0.0.1